# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python


class Recipe(custom.GStreamer):
    name = 'gst-plugins-good-1.0'
    config_sh = 'sh ./autogen.sh --noconfigure && ./configure'
    configure_options = '--enable-static --disable-examples --disable-oss4 --disable-oss --disable-dv1394 --disable-aalib --disable-libcaca --disable-jack --disable-shout2 '
    remotes = {'origin': 'git://anongit.freedesktop.org/gstreamer/gst-plugins-good'}
    commit = 'acb50ce82e431f04755f072ca9d026d0e6e8fbc0'
    deps = ['gstreamer-1.0', 'gst-plugins-base-1.0', 'orc', 'bzip2', 'zlib',
            'libvpx']


    files_lang = ['gst-plugins-good-1.0']

    files_plugins_core = [
             'lib/gstreamer-1.0/libgstvideofilter%(mext)s',
    ]

    files_plugins_core_devel = [
             'lib/gstreamer-1.0/libgstvideofilter.a', 'lib/gstreamer-1.0/libgstvideofilter.la',
    ]

    files_plugins_effects = [
             'lib/gstreamer-1.0/libgstvideocrop%(mext)s',
    ]

    files_plugins_effects_devel = [
             'lib/gstreamer-1.0/libgstvideocrop.a', 'lib/gstreamer-1.0/libgstvideocrop.la',
    ]

    files_plugins_codecs = [
             'lib/gstreamer-1.0/libgstalaw%(mext)s',
             'lib/gstreamer-1.0/libgstmulaw%(mext)s',
             'lib/gstreamer-1.0/libgstvpx%(mext)s',
    ]

    files_plugins_codecs_devel = [
             'lib/gstreamer-1.0/libgstalaw.a', 'lib/gstreamer-1.0/libgstalaw.la',
             'lib/gstreamer-1.0/libgstmulaw.a', 'lib/gstreamer-1.0/libgstmulaw.la',
             'lib/gstreamer-1.0/libgstvpx.a', 'lib/gstreamer-1.0/libgstvpx.la',
    ]

    files_plugins_net = [
             'lib/gstreamer-1.0/libgstrtp%(mext)s',
             'lib/gstreamer-1.0/libgstrtpmanager%(mext)s',
             'lib/gstreamer-1.0/libgstudp%(mext)s',
    ]

    files_plugins_net_devel = [
             'lib/gstreamer-1.0/libgstrtp.a', 'lib/gstreamer-1.0/libgstrtp.la',
             'lib/gstreamer-1.0/libgstrtpmanager.a', 'lib/gstreamer-1.0/libgstrtpmanager.la',
             'lib/gstreamer-1.0/libgstudp.a', 'lib/gstreamer-1.0/libgstudp.la',
    ]

    files_plugins_vis = [
    ]

    files_plugins_vis_devel = [
    ]

    files_plugins_capture = []
    files_plugins_capture_devel = []

    files_plugins_sys = []
    files_plugins_sys_devel = []

    platform_files_plugins_sys = {
        Platform.WINDOWS: [
             'lib/gstreamer-1.0/libgstdirectsoundsink%(mext)s',
            ],
        Platform.DARWIN: [
             'lib/gstreamer-1.0/libgstosxaudio%(mext)s',
            ],
        Platform.IOS: [
             'lib/gstreamer-1.0/libgstosxaudio%(mext)s'
        ]
    }

    platform_files_plugins_sys_devel = {
        Platform.WINDOWS: [
             'lib/gstreamer-1.0/libgstdirectsoundsink.a', 'lib/gstreamer-1.0/libgstdirectsoundsink.la',
            ],
        Platform.DARWIN: [
             'lib/gstreamer-1.0/libgstosxaudio.a', 'lib/gstreamer-1.0/libgstosxaudio.la',
            ],
        Platform.IOS: [
             'lib/gstreamer-1.0/libgstosxaudio.a', 'lib/gstreamer-1.0/libgstosxaudio.la'
        ]
    }

    def prepare(self):
        # The second detail is to work around use of deprecated NSOpenGLPFAFullScreen on OS X 10.10
        self.append_env['CFLAGS'] = " -Wno-error -Wno-error=deprecated-declarations -DGSTREAMER_GLIB_COCOA_NSAPPLICATION=1 -DLIBSOUP_DOES_NOT_STEAL_OUR_CONTEXT=1 "
        self.append_env['OBJCFLAGS'] = " -Wno-error -DGSTREAMER_GLIB_COCOA_NSAPPLICATION=1 "
        self.append_env['CXXFLAGS'] = " -Wno-error -Wno-error=deprecated-declarations "
        self.append_env['CPPFLAGS'] = " -Wno-error -Wno-error=deprecated-declarations "
        if self.config.target_platform != Platform.LINUX:
            self.configure_options += ' --disable-gtk-doc '
        if self.config.target_platform == Platform.WINDOWS:
            self.configure_options += ' --disable-aalib --disable-esd '
        if self.config.target_platform == Platform.LINUX:
            self.use_system_libs = True
            self.files_plugins_capture += ['lib/gstreamer-1.0/libgstvideo4linux2%(mext)s']
            self.files_plugins_sys += ['lib/gstreamer-1.0/libgstpulse%(mext)s']
        else:
            self.configure_options += ' --disable-gst_v4l2'
            self.configure_options += ' --disable-pulse'
        self.configure_options += ' --disable-x --disable-xvideo'

        if self.config.variants.nodebug:
            self.append_env['CFLAGS'] += ' -DGST_LEVEL_MAX=GST_LEVEL_FIXME'
